<include file="Public/min-header" />
<script type="text/javascript">
    window.UEDITOR_Admin_URL = "__ROOT__/Public/plugins/Ueditor/";
    var URL_upload = "{$URL_upload}";
    var URL_fileUp = "{$URL_fileUp}";
    var URL_scrawlUp = "{$URL_scrawlUp}";
    var URL_getRemoteImage = "{$URL_getRemoteImage}";
    var URL_imageManager = "{$URL_imageManager}";
    var URL_imageUp = "{$URL_imageUp}";
    var URL_getMovie = "{$URL_getMovie}";
    var URL_home = "{$URL_home}";
</script>
<load href="__ROOT__/Public/plugins/Ueditor/ueditor.config.js" />
<load href="__ROOT__/Public/plugins/Ueditor/ueditor.all.js" />
<link href="__PUBLIC__/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<script src="__PUBLIC__/plugins/daterangepicker/moment.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<div class="wrapper">
    <include file="Public/breadcrumb" />
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="box box-info">
                    <div class="box-header with-border">
                        <h3 class="box-title">发布消息</h3>
                        <a href="{:U('Article/articleList')}" data-toggle="tooltip" title="" class="btn btn-primary pull-right" data-original-title="返回"><i class="fa fa-reply"></i></a>
                    </div>
                    <form class="form-horizontal" action="{:U('Message/add')}" id="add_post" method="post">
                        <div class="box-body">
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">消息标题</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" value="{$info.title}" name="title">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="text" class="col-sm-2 control-label">是否显示</label>
                                <div class="col-sm-5" style="margin-top:5px;">
                                    <div class="col-sm-2">
                                        <label>
                                            <input type="radio" name="status" value="1" checked> 显示 </label>
                                    </div>
                                    <div class="col-sm-3">
                                        <label>
                                            <input type="radio" name="status" value="0"> 不显示</label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-sm-2">消息内容</label>
                                <div class="col-sm-8">
                                    <textarea style="height:200px;" class="form-control" name="content" title="">{$info.content}</textarea>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-sm-2">
                                    <input type="hidden" name="act" value="{$act}">
                                    <input type="hidden" name="article_id" value="{$info.article_id}">
                                </label>
                                <div class="col-sm-8">
                                    <button type="reset" class="btn btn-primary">重置</button>
                                    <button type="button" onclick="checkForm()" class="btn btn-info pull-right">提交</button>
                                </div>
                            </div>
                        </div>
                        <div class="box-footer row">
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
</div>
<script type="text/javascript">

	function call_back2(paths) {
		console.log(paths);
        var last_div = $(".goods_xc:last").prop("outerHTML");
        for (i = 0; i < paths.length; i++) {
            $(".goods_xc:eq(0)").before(last_div); // 插入一个 新图片
            $(".goods_xc:eq(0)").find('a:eq(0)').attr('href', paths[i]).attr('onclick', '').attr('target', "_blank"); // 修改他的链接地址
            $(".goods_xc:eq(0)").find('img').attr('src', paths[i]); // 修改他的图片路径
            $(".goods_xc:eq(0)").find('a:eq(1)').attr('onclick', "ClearPicArr2(this,'" + paths[i] + "')").text('删除');
            $(".goods_xc:eq(0)").find('input').val(paths[i]); // 设置隐藏域 要提交的值
            ; // 设置隐藏域 要提交的值
        }
    }
	function ClearPicArr2(obj,id){
		if(window.confirm('确定要删除该图片吗？')){
			$.post("{:U('Rural/del_img')}",{id:id},function(data){
				if(data.code==200){
					$(obj).parent().remove();
					alert('删除成功');
				}else{
					alert('删除失败');
				}
			},'json');
		}	
	}
    function checkForm() {
        if ($('input[name="title"]').val() == '') {
            alert("请填写消息标题！");
            return false;
        }
        if ($('#post_content').val() == '') {
            alert("请填写消息内容！");
            return false;
        }
        $('#add_post').submit();
    }
</script>
</body>
</html>
